package com.zhen.aikan.controller;

import com.zhen.aikan.entity.Advertising;
import com.zhen.aikan.service.IAdvertisingService;
import com.zhen.aikan.vo.Result;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 *
 * @author lijiazhen
 * @since 2023-09-11
 */
@RestController
@RequestMapping("/api/ad")
public class AdvertisingController {
    @Autowired
    private IAdvertisingService adService;
    @ApiOperation("根据类型获取广告或公告")
    @GetMapping("/adOrAm/{type}")
    public Result adOrAnnouncement(@PathVariable String type){
        List<Advertising> ads = adService.getAdByType(type);
        return Result.ok(ads);
    }
}
